/*

*/
<template>
	<view class="anchor-homepage">
		<c-layout>
			<!-- 头部 -->
			<c-navigation-bar slot="head" navbar-bg-color="transparent" :isSearch="false" :isRightIcon="true"
				left-icon-border="#E1E8E8" left-icon-color="#fff" @backEvent="toUser">
				<template slot="rightIcon">
					<bubble ref="bubble" :data="bubble2.data " @bubbleLineClick='bubbleLineClick'></bubble>
				</template>
			</c-navigation-bar>

			<!--内容-->
			<view class="container-box">
				<view class="head-suspension">
					<u-avatar
						:src='vuex_user_info.avatar?$u.file.getMedieUrl(vuex_user_info.avatar):$u.file.getMedieUrl(vuex_userDefaultTopImg)'
            shape="circle" size="200" :show-level='true' :level-icon='cameraFill'>
					</u-avatar>
					<text class="name box-center">{{ vuex_user_info.nickName }}</text>
				
					<text class="ID">{{ vuex_user_info.personalIntroduction}} </text>
					<view class="ID">
						UID:{{vuex_user_info.newUserRandomId}}
					</view>
					<text class="">

						<u-button type="primary" @click="editClick()">{{$t('user.ProfileEditor')}}
						</u-button>

					</text>

					<view class="data">
						<view class="num" @click="goFollowed('concern',vuex_user_info.concern)">
							<text>{{ Number(vuex_user_info.concern)>=10000?(Number(vuex_user_info.concern)/10000).toFixed(2)+'w':Number(vuex_user_info.concern)>=1000?(Number(vuex_user_info.concern)/1000).toFixed(2)+'k': Number(vuex_user_info.concern)}}</text>
							<text>{{$t('storeOfInterest.concern')}}</text>
						</view>
						<view class="num" @click="goFansClick('fans',vuex_user_info.fans)">
						<text>{{ Number(vuex_user_info.fans)>=10000?(Number(vuex_user_info.fans)/10000).toFixed(2)+'w':Number(vuex_user_info.fans)>=1000?(Number(vuex_user_info.fans)/1000).toFixed(2)+'k': Number(vuex_user_info.fans)}}</text>
							<text>{{$t('storeOfInterest.fans')}}</text>
						</view>
						<view class="num" @click="goVideo('like',Number(vuex_user_info.like))">
							<text>{{ Number(vuex_user_info.like)>=10000?(Number(vuex_user_info.like)/10000).toFixed(2)+'w':Number(vuex_user_info.like)>=1000?(Number(vuex_user_info.like)/1000).toFixed(2)+'k': Number(vuex_user_info.like)}}</text>
							<text>{{$t('storeOfInterest.like')}}</text>
						</view>
					</view>


				</view>
				<userTabs></userTabs>
			</view>
		</c-layout>




		<c-share v-model="sharePopShow" :data="shareData"></c-share>
	</view>
</template>

<script>
	import bubble from "@/pages/searchInfo/components/bubble.vue"
	// import lineProductCard from "../../productCard.vue"
	import userTabs from './userTabs.vue'
	export default {
		components: {
			bubble,
			userTabs
		},
		data() {
			return {
				cameraFill: require('static/images/icon-avator-home.png'),
				imgGroup: [require('static/images/login/ins.png'), require('static/images/login/facebook.png'), require(
					'static/images/login/tiktok.png'), require('static/images/login/YouTube.png')],
				//搜索
				search: {
					navThmen: 'line',
					navPlaceholder: 'Donate for',
					navType: 'navBackTitle'
				},



				collectionData: [],
				bubble2: {
					data: [{
						text: this.$t('system.ShareCode'),
						icon: 'grid',
						url: '/pages/invitation/invitation',
					}]
				},
				sharePopShow: false,
				concerns: false,
				friendList: [],
				sendSvg: require('@/static/images/send.svg'),
				pagingObj: {
					pageSize: 20,
					pageNum: 1
				},
				paging: {
					current: 1,
					size: 10
				},
				empty: {
					show: false,
					img: '',
					title: this.$t('system.NoRecord'),
					hint: '',
					buttonText: ''
				},
				total: 0

			}

		},
		computed: {
			screenHeight() {
				return this.$store.getters.homePageWindowInfo.screenHeight
			},
			// 分享数据
			shareData() {
				console.log(this.vuex_anchor_info, 5648651);
				return {
					// this.vuex_user_info.id
					id: '',
					name: `anchorHome`,
					url: `/pages/searchInfo/components/anchorCard/anchorHomepage?type=outSide&userId=${this.vuex_anchor_info.userId||''}`,
					p: {
						'type': 'outSide',
						"userId": this.vuex_anchor_info.userId
					}
				}
			}
		},
		onLoad(data) {
				this.cameraFill = this.$u.file.getMedieUrl(this.vuex_user_info.userLevelIcon)
		},
		mounted() {

		},
		methods: {


			//点击更右上角更多图标
			bubbleLineClick(item, index) {
				if (item.url) {
					if (item.url) {
						console.log(item.url);
						this.$u.route({
							url: item.url,
							params: item.data
						})
					}
				}
				console.log(666, 99, item);
				if (item.icon == 'share') {
					this.sharePopShow = true
				}
			},
			// 编辑个人信息
			editClick() {
				this.$u.init.whetherToLogin(() => {
					uni.navigateTo({
						url: `/pages/searchInfo/components/anchorCard/anchorHomepage/bubble/edit`,
						"animationType": "slide-in-right",
						"animationDuration": 300
					})
				})
			},

			//查看用户已关注列表
			goFollowed(type, num) {
				if (num > 0) {
					this.$u.route('pages/user/components/Followed')
				}
			},	
			//点击统计跳转
			goFansClick(type, num) {
				if (num > 0) {
					this.$u.route('pages/anchorConsole/page/fansClub')
				}
			},
			//点击点赞
			goVideo(type, num) {
				if (num > 0) {
					this.$u.route('pages/searchInfo/components/anchorCard/anchorHomepage/page/video', {
						type: type
					})
				}
			},
			toUser(){
				uni.switchTab({
					url:'/pages/user/user'
				})
			}
		},
		

		//离开页面关闭气泡
		// onHide(type) {
		//     this.$refs.bubble.moreClick()
		// }
	}
</script>

<style lang="scss" scoped>
	.anchor-homepage {
		background-color: #1B1D29;
		position: relative;
		width: 100vw;
		min-height: 100vh;
		background: url('../../../static/images/user/user_bg1.png') no-repeat 100% 100% #1b1d295c;
		background-size: 100% 100%;
		
		.container-box {
			padding-top: 160rpx;
			position: relative;
			min-height: 100%;
			display: flex;
			flex-direction: column;
			
			.head-suspension {
				flex: 1;
				display: flex;
				flex-direction: column;
				background-color: #fff;
				width: 100%;
				border-radius: 60rpx 60rpx 0rpx 0rpx;
				padding: 150rpx 40rpx 0 40rpx;
				position: relative;

				.u-avatar {
					position: absolute;
					top: -95rpx;
					left: 50%;
					transform: translateX(-50%);

					///deep/ .u-avatar__img {
					//	border-radius: 40rpx !important;
					//}

					/deep/ .u-avatar__level {
						right: 15rpx !important;
						bottom: 20rpx !important;
					}

					/deep/ .u-iconfont {
						font-size: 50rpx !important;
						right: 0;
						color: #35E8F7;
					}
				}

				.name {
					display: block;
					color: #02010E;
					font-size: 48rpx;
					text-align: center;
				}

				.ID {
					display: block;
					text-align: center;
					color: #91909A;
					font-size: 32rpx;
					margin: 10rpx 0;
				}

				.box-center {
					text-align: center;
					display: block;
				}

				.shopRateName {
					color: rgba(95, 100, 140, 1);
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 18rpx;
					width: 80rpx;
					height: 38rpx;
					border-radius: 4rpx;
					border: 1rpx solid rgba(189, 188, 199, 1);
					box-sizing: border-box;
					background: rgba(252, 250, 254, 1);
					line-height: 34rpx;
					text-align: center;
					margin: 10rpx auto;
				}

				.data {
					display: flex;
					justify-content: space-between;

					.num {
						width: 30%;

						uni-text {
							color: #02010E;
							font-size: 40rpx;
							display: block;
							text-align: center;

							&:nth-child(2) {
								margin-top: 10rpx;
								color: #91909A;
								font-size: 28rpx;
							}
						}
					}
				}

				/deep/ .u-avatar__level {
					.u-icon__img {
						width: 34px !important;
					}
				}
			}
		}

		.empty {
			top: 18%;
			width: 100%;

			uni-image {
				width: 100%;
			}

			uni-text {
				display: block;
				text-align: center;
				color: #666666;
				font-size: 26rpx;
			}

			uni-button {
				left: 0;
				margin-top: 40rpx;
				width: 100%;
				height: 120rpx;
				background: #2934D0;
				border-radius: 20rpx;
				transform: translateX(-50%);
				left: 50%;
			}
		}

		.video-box {
			display: flex;
			flex-wrap: wrap;

			>view {
				margin-bottom: 18rpx;

				&:not(:first-child):not(:nth-child(3n+1)) {
					margin-left: 10rpx;
				}
			}
		}

	}

	/deep/ .container-box {
		padding: 0;
	}

	/deep/ .user-tabs {
		background: #fff;
		padding: 20px 14px;
		min-height: 54vh;
		position: relative;
		/* border: none; */
		top: -1px;
	}

	/deep/ .u-btn {
		width: 90px;
		height: 32px;
		mix-blend-mode: normal;
		font-size: 12px;
		border-radius: 10px;
		color: rgba(145, 144, 154, 1);
		background: rgba(244, 244, 244, 1);
		margin: 20rpx auto;
	}
</style>